package com.luodea.rabbitmqconsume;

import com.luodea.common.RabbitMqConfig;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.messaging.handler.annotation.Payload;
import org.springframework.stereotype.Component;

import java.io.UnsupportedEncodingException;

/**
 * @author luodea
 * @date 2020/2/4 17:23
 * @description
 */
//@Component
//@RabbitListener(queues = RabbitMqConfig.Headers.Queue.IMAGE)
public class NoAckConsume {

    @RabbitHandler
    public void handle(@Payload String message){
        System.out.println(message);
    }

    @RabbitHandler
    public void handle(@Payload byte[] bytes) throws UnsupportedEncodingException {
        System.out.println(new String(bytes,"utf-8"));
    }

}
